<?php
use common\components\widgets\Datetimepicker;
use common\components\helpers\Fun;
use common\components\extenders\MenuManage;
use doumiaoduo\layer\LayerConfirmWidget;
use doumiaoduo\layer\LayerIframeWidget;

LayerConfirmWidget::widget();
LayerIframeWidget::widget();
use yii\helpers\Html;
Datetimepicker::widget(['flag'=>'timepicker']);
Datetimepicker::widget(['timepicker' => 'true','datepicker'=>'false','format'=>'H:i','step'=>'5']);
?>
<div class="yx-cnt-box yx-radius2">
    <div class="yx-praise-box">
        <div class="yx-search-class">
            <h3 class="yx-menubar yx-noborder">搜索课程班级：</h3>
            <div class="yx-praise-list-box yx-praise-box yx-radius2 ">
                <div id="search-area" class="yx-bgf7f7f7 yx-radius5 zx-mg yx-function2 yx-pr0">
                    <?= Html::beginForm(Fun::url(['oldclassmanage/index']), 'get', ['enctype' => 'multipart/form-data']) ?>
                    <?= \common\components\helpers\Search::textInput('teacher', \Yii::$app->request->get('teacher'), ['label'=>'教师姓名','class' => 'yx-width150 zx-lh24 yx-ml6']); ?>
                    <?= \common\components\helpers\Search::textInput('course', \Yii::$app->request->get('course'), ['label'=>'课程名称','class' => 'yx-width150 zx-lh24 yx-ml6']); ?>
                    <?= \common\components\helpers\Search::textInput('classroom', \Yii::$app->request->get('classroom'), ['label'=>'教室名称','class' => 'yx-input-text zx-width150 yx-ml6']); ?>
                    <?= \common\components\helpers\Search::textInput('mechanic', \Yii::$app->request->get('mechanic'), ['label'=>'机构','class' => 'yx-input-text zx-width150 yx-ml6']); ?>
                    <?= \common\components\helpers\Search::dropDownList('status', \Yii::$app->request->get('status'), [null=>'请选择',0=>'未开班',1=>'已开班'],['label'=>'状态','class' => 'diy_select_txt','promote'=>'请选择']); ?>
                    <?= \common\components\helpers\Search::textInput('opentime', \Yii::$app->request->get('opentime'), ['label'=>'开班日期','class' => 'timepicker yx-input-text zx-width150 yx-ml6']); ?>
                    <?= \common\components\helpers\Search::textInput('start_time', \Yii::$app->request->get('start_time'), ['label'=>'上课时间','class' => 'search datetimepicker yx-width150 zx-lh24 yx-ml6']); ?>
                    <?= \common\components\helpers\Search::submitButton('搜索', ['id'=>'search-handle','class'=>"yx-search yx-radius2"]); ?>
                    <?php Html::endForm() ?>
                </div>

                <div class="bodyCon08" style="display: none "><!--学员-->
                    <div class="students">
                        <div id="four_flash">
                            <div class="flashBg">
                                <ul class="mobile">
                                    <li>
                                        <div class="yx-bg-icon img-circle"><i class="yx-icon"></i></div>
                                        <dd>舞蹈类</dd>
                                        <a href=""></a> </li>
                                    <li>
                                        <div class="yx-bg-icon img-circle"><i class="yx-icon"></i></div>
                                        <dd>书画类</dd>
                                        <a href=""></a> </li>
                                    <li>
                                        <div class="yx-bg-icon img-circle"><i class="yx-icon"></i></div>
                                        <dd>表演类</dd>
                                        <a href=""></a> </li>
                                    <li>
                                        <div class="yx-bg-icon img-circle"><i class="yx-icon"></i></div>
                                        <dd>模特类</dd>
                                        <a href=""></a> </li>
                                    <li>
                                        <div class="yx-bg-icon img-circle"><i class="yx-icon"></i></div>
                                        <dd>体育类</dd>
                                        <a href=""></a> </li>
                                    <li>
                                        <div class="yx-bg-icon img-circle"><i class="yx-icon"></i></div>
                                        <dd>手工类</dd>
                                        <a href=""></a> </li>
                                    <li>
                                        <div class="yx-bg-icon img-circle"><i class="yx-icon"></i></div>
                                        <dd>棋类</dd>
                                        <a href=""></a> </li>
                                    <li>
                                        <div class="yx-bg-icon img-circle"><i class="yx-icon"></i></div>
                                        <dd>西洋乐类</dd>
                                        <a href=""></a> </li>
                                    <li>
                                        <div class="yx-bg-icon img-circle"><i class="yx-icon"></i></div>
                                        <dd>键盘类</dd>
                                        <a href=""></a> </li>
                                    <li>
                                        <div class="yx-bg-icon img-circle"><i class="yx-icon"></i></div>
                                        <dd>文化辅导类</dd>
                                        <a href=""></a> </li>
                                    <li>
                                        <div class="yx-bg-icon img-circle"><i class="yx-icon"></i></div>
                                        <dd>民乐类</dd>
                                        <a href=""></a> </li>
                                    <li>
                                        <div class="yx-bg-icon img-circle"><i class="yx-icon"></i></div>
                                        <dd>流行打击类</dd>
                                        <a href=""></a> </li>
                                    <li>
                                        <div class="yx-bg-icon img-circle"><i class="yx-icon"></i></div>
                                        <dd>科学益智类</dd>
                                        <a href=""></a> </li>
                                    <li>
                                        <div class="yx-bg-icon img-circle"><i class="yx-icon"></i></div>
                                        <dd>声乐合唱类</dd>
                                        <a href=""></a> </li>
                                </ul>
                            </div>
                            <div class="but_left"></div>
                            <div class="but_right"></div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="yx-class-box">
                <ul class="nav nav-tabs yx-nav-tabs1 yx-mb0" id="myTab" style="display: none">
                    <li class="active yx-width124"><a href="#class11" data-toggle="tab">已开班</a></li>
                    <li class="yx-width124"><a href="#class12" data-toggle="tab">未开班</a></li>
                </ul>
                <div class="tab-content">
                    <div class="tab-pane active" id="class11">
                        <?php if($data):?>
                            <?php foreach($data as $item):?>
                                <div class="yx-class-list yx-radius2 yx-floatl">
                                    <img src="<?=$item['avatar']?>" class="yx-border1 img-circle" width="73" height="73">
                                    <ul>
                                        <li>课程名称：<?=$item['course_name']?></li>
                                        <li>机构名称：<?=$item['mechanic_name']?></li>
                                        <li>教师姓名：<?=$item['teacher_name']?></li>
                                        <li>教室名称：<?=$item['classroom_name']?></li>
                                        <li>开班人数：<?=$item['opening_number']?>人</li>
                                        <li>报名人数：<?=$item['COUNT(id)']?>人</li>
                                        <li>最大人数：<?=$item['max_number']?>人</li>
                                        <li>上课时间：<?=$item['class_time']?></li>
                                        <li>开班时间：<?= ($item['start_time'] == null) ? '未开班' : \Yii::$app->formatter->asDatetime($item['start_time']) ?></li>
                                        <li>状态：<?php
                                            switch($item['status']) {
                                                case 0:
                                                    echo '未开班';
                                                    break;
                                                case 1:
                                                    echo '已开班';
                                                    break;
                                                case 2:
                                                    echo '已结束';
                                                    break;
                                            }
                                            ?></li>
                                    </ul>

                                    <?php if ($item['status'] == 0) { ?>
                                        <?php if($item['is_open'] == 1):?>
                                            <?=(new MenuManage(MenuManage::TOP_MENU))->detailsMenu('oldclassmanage','open',false,['rel'=>'dialog-show-iframe','class' => 'btn yx-classmagage-about yx-class-begin yx-bg67dcd6 yx-radius2','data'=>['id'=>$item['id'],'name'=>'开班']]);?>
                                        <?php endif?>
                                        <?php if ($item['max_number'] >= $item['COUNT(id)']) { ?>
                                            <?=(new MenuManage(MenuManage::TOP_MENU))->detailsMenu('oldclassmanage','addoldstudent',false,['rel'=>'dialog-show-iframe','class' => 'btn yx-classmagage-about yx-width47  yx-bg67dcd6 yx-radius2','data'=>['id'=>$item['id'],'name'=>'添加学员']]);?>
                                        <?php } ?>
                                        <?php if($item['COUNT(id)'] == 0):?>
                                            <?=(new MenuManage(MenuManage::TOP_MENU))->detailsMenu('oldclassmanage','delete',false,['rel'=>'record_item_confirm','class' => 'btn yx-classmagage-about yx-width47 yx-bgb5b5b5 yx-radius2 yx-mr0','data'=>['id'=>$item['id'],'name'=>'删除','message'=>'确定要删除么？']]);?>
                                        <?php endif;?>
                                        <?php
                                    } else { ?>
                                        <?=(new MenuManage(MenuManage::TOP_MENU))->detailsMenu('oldclassmanage','details',false,['rel'=>'dialog-show-iframe','class' => 'btn yx-classmagage-about yx-width47 yx-bgfbc74f yx-radius2','data'=>['id'=>$item['id'],'name'=>'学员列表']]);?>
                                        <?=(new MenuManage(MenuManage::TOP_MENU))->detailsMenu('oldclassmanage','lesson',false,['rel'=>'dialog-show-iframe','class' => 'btn yx-classmagage-about yx-width47 yx-bgfbc74f yx-radius2 yx-mr0','data'=>['id'=>$item['id'],'name'=>'课时详情']]);?>
                                        <?php if($item['status'] == 1 && ($item['end_time'] != null && time() > $item['end_time'] )):?>
                                            <?=(new MenuManage(MenuManage::TOP_MENU))->detailsMenu('oldclassmanage','endcourse',false,['rel'=>'record_item_confirm','class' => 'btn yx-classmagage-about yx-width47 yx-bgfbc74f yx-radius2','data'=>['id'=>$item['id'],'name'=>'结课','message'=>'确定课程已结束么？']]);?>
                                        <?php endif;?>
                                        <?php if ($item['max_number'] >= $item['COUNT(id)'] && $item['status'] != 2) { ?>
                                            <?=(new MenuManage(MenuManage::TOP_MENU))->detailsMenu('oldclassmanage','addoldstudent',false,['rel'=>'dialog-show-iframe','class' => 'btn yx-classmagage-about yx-width47 yx-bg67dcd6 yx-radius2 yx-mr0','data'=>['id'=>$item['id'],'name'=>'添加学员']]);?>
                                        <?php } ?>
                                    <?php } ?>
                                </div>
                            <?php endforeach;?>
                        <?php endif;?>

                        <div class="yx-clear"></div>
                    </div>
                    <div style="text-align: right"><?= common\components\widgets\GoPager::widget(['pagination' => $pages]) ?></div>
                </div>
            </div>
        </div>
    </div>